package net.sf.jsqlparser.statement.create.table;

import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.StatementVisitor;

public class CreateIndex implements Statement {
	private String indexType = "Hashmap";
	private String type = null;//additional, unique, primary key
	private String indexName = null;//�������
	private Table table = null;//�����
	private String columnName = null;//�����
	private boolean isIfNotExists = false;
	private String additionalValType = null;
	@Override
	public void accept(StatementVisitor statementVisitor) {
		// TODO Auto-generated method stub
		
	}

	public String getIndexType() {
		return indexType;
	}

	public void setIndexType(String indexType) {
		this.indexType = indexType;
	}



	public String getIndexName() {
		return indexName;
	}

	public void setIndexName(String indexName) {
		this.indexName = indexName;
	}
	

	public Table getTable() {
		return table;
	}

	public void setTable(Table table) {
		this.table = table;
	}

	public boolean isIfNotExists() {
		return isIfNotExists;
	}

	public void setIfNotExists(boolean isIfNotExists) {
		this.isIfNotExists = isIfNotExists;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getAdditionalValType() {
		return additionalValType;
	}

	public void setAdditionalValType(String additionalValType) {
		this.additionalValType = additionalValType;
	}
	

	public String getColumnName() {
		return columnName;
	}

	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	public String toString(){
		String sql = "CREATE";
		if (type != null) {
			sql += " "+type;
		}
		sql += " " + indexType + " INDEX";
		if (isIfNotExists) {
			sql += " IF NOT EXISTS";
		}

		sql += " " + indexName + " ON " + table.toString()+"("+columnName+")";
		if (additionalValType != null) {
			sql += " " + additionalValType;
 		}
		return sql;
	}
}
